#!/usr/bin/perl
#delrule.cgi

require './netfilter-lib.pl';
&ReadParse();
&error_setup($text{'error_mesg'});
$ruleline=$in{'ruleline'};
$type=$in{'command'};
#&error($type);
if($type =~ /delete/){
  if($ruleline =~ /^\d+$/) {
  	system("/sbin/iptables -D INPUT $ruleline");
  }
}
if($type =~ /delall/){
  system("/sbin/iptables -F");
  system("/sbin/iptables -X");
  system("/sbin/iptables -Z");    
}
system("/sbin/iptables-save > /etc/sysconfig/iptables");
&redirect("index.cgi");
